<%--
  @author  lk
  DateTime: 2020/4/14 0014 13:48
--%>
<%@ page import="com.lk.bean.Goods" %>
<%@ page import="java.util.Map" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>商品详情</title>
</head>
<body>
<%
    String goodsId = request.getParameter("id");
    Map<Goods, Integer> map = (Map<Goods, Integer>) request.getServletContext().getAttribute("allGoods");
    Goods g = new Goods();
    int totalNum = 0;
    for (Goods goods : map.keySet()) {
        if (goodsId.equals(goods.getGoodsId())){
            g = goods;
            totalNum = map.get(goods);
            session.setAttribute("goods",goods);
        }
    }
%>
<table align="center" width="100%">
    <tr>
        <th>商品编号</th>
        <th>商品展示</th>
        <th>商品名称</th>
        <th>商品单价</th>
        <th>商品销量</th>
    </tr>
    <%

    %>
    <tr align="center">
        <td><%=g.getGoodsId() %>
        </td>
        <td><img src="<%=g.getGoodsImg() %>">
        </td>
        <td><%=g.getGoodsName() %>
        </td>
        <td><%=g.getGoodsPrice() %>
        </td>
        <td><%=totalNum%>
        </td>
    </tr>
    <tr>
        <td colspan=" 2"></td>
        <td><a href="docart.jsp">添加到购物车</a></td>
        <td><a href="index.jsp">商城首页</a></td>

        <td colspan=" 2"></td>
    </tr>
</table>
</body>
</html>
